/*
 * $Id: TcpSocket.h,v 1.6 2006-02-08 11:37:31 bacon Exp $
 */


#ifndef _XPP_NET_TCPSOCKET_CLASS_
#define _XPP_NET_TCPSOCKET_CLASS_

#include <xpp/net/InetSocket.h>
#include <xpp/net/InetAddress.h>
#include <xpp/net/Connectable.h>
#include <xpp/net/Listenable.h>

namespace xpp
{
	namespace net
	{

		class TcpSocket: 
			public InetSocket, public Connectable, public Listenable
		{
		public:
			TcpSocket ();

			int open (Handle handle);
			int open (Handle handle, const Address& address);
			int open (const Address& address);

			int connect ();
			int connectx ();
			int listen (int backlog = 10);

			Socket* accept  (
				Socket* peer_sck = XP_NULL, 
				Address* peer_adr = XP_NULL);
			int drop ();

			virtual bool canCancelConnect ()
			{
				return false;
			}

		protected:
			static xp_bool_t __cancel_connect (void* arg);
		};

	}
}

#endif
